package com.example.iocdemo;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class Computer {

    //品牌
    @Value("小米")
    private String brand;
    //CPU属性
    @Resource
    private Cpu cpu;
    //内存属性
    @Resource
    private Memory memory;

    //启动电脑
    public void start() {
        System.out.println("电脑开机了");
        cpu.run();
        memory.read();
        memory.write();
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public Cpu getCpu() {
        return cpu;
    }

    public void setCpu(Cpu cpu) {
        this.cpu = cpu;
    }

    public Memory getMemory() {
        return memory;
    }

    public void setMemory(Memory memory) {
        this.memory = memory;
    }
}
